package com.heima.test8;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo01 {
    public static void main(String[] args) {
        //1,创建一个默认的线程池对象.需要制定一个线程池的数量
        //通过看newFixedThreadPool方法 这个线程池只有核心线程 而且队列是无界的
        ExecutorService executorService = Executors.newFixedThreadPool(3);

        executorService.execute(new MyRunnable(1));
        executorService.execute(new MyRunnable(2));
        executorService.execute(new MyRunnable(3));
        executorService.execute(new MyRunnable(4));
        executorService.execute(new MyRunnable(5));

        executorService.shutdown();
    }
}
